int blocking:1;
/* communication rings */
struct libxenvchan_ring read, write;
+ /**
+ * Base xenstore path for storing ring/event data used by the server
+ * during cleanup.
+ * */
+ char *xs_path;
};
/**
#include <xen/sys/gntdev.h>
#include <libxenvchan.h>
+#include "vchan.h"
+
#ifndef PAGE_SHIFT
#define PAGE_SHIFT 12
#endif
char ref[16];
char* domid_str = NULL;
xs_transaction_t xs_trans = XBT_NULL;
+
+ /* store the base path so we can clean up on server closure */
+ ctrl->xs_path = strdup(xs_base);
+ if (!ctrl->xs_path)
+ return -1;
+
xs = xs_open(0);
if (!xs)
goto fail;
return ret;
}
+void close_xs_srv(struct libxenvchan *ctrl)
+{
+ struct xs_handle *xs;
+
+ if (!ctrl->xs_path)
+ return;
+
+ xs = xs_open(0);
+ if (xs) {
+ xs_rm(xs, XBT_NULL, ctrl->xs_path);
+ xs_close(xs);
+ }
+
+ free(ctrl->xs_path);
+}
+
static int min_order(size_t siz)
{
int rv = PAGE_SHIFT;
--- /dev/null
+/**
+ * @file
+ * @section AUTHORS
+ *
+ * Copyright (C) 2021 EPAM Systems Inc.
+ *
+ * @section LICENSE
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @section DESCRIPTION
+ *
+ * This file contains common libxenvchan declarations.
+ */
+#ifndef LIBVCHAN_H
+#define LIBVCHAN_H
+
+void close_xs_srv(struct libxenvchan *ctrl);
+
+#endif /* LIBVCHAN_H */